package org.smarthings.things.management.rest;

import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;

import org.smarthings.things.management.rest.resources.actions.ThingActionMetadataCollectionResource;
import org.smarthings.things.management.rest.resources.actions.ThingActionMetadataResource;
import org.smarthings.things.management.rest.resources.actions.ThingMetadataLocatorResource;
import org.smarthings.things.management.rest.resources.properties.ThingPropertyMetadataCollectionResource;
import org.smarthings.things.management.rest.resources.properties.ThingPropertyMetadataResource;

@Path("things")
public interface RemoteThingsMetadataManagement {

	@GET
	@Path("metadata")
	ThingMetadataLocatorResource locateThingsMetadata() throws WebApplicationException;

	@GET
	@Path("metadata/properties")
	ThingPropertyMetadataCollectionResource getThingPropertiesMetadata()
			throws WebApplicationException;

	@PUT
	@Path("metadata/properties/{propertyName}")
	Response registerThingPropertyMetadata(@PathParam("propertyName") String propertyName,
			ThingPropertyMetadataResource created) throws WebApplicationException;

	@GET
	@Path("metadata/properties/{propertyName}")
	ThingPropertyMetadataResource getThingPropertyMetadata(
			@PathParam("propertyName") String propertyName) throws WebApplicationException;

	@DELETE
	@Path("metadata/properties/{propertyName}")
	Response unregisterThingPropertyMetadata(@PathParam("propertyName") String propertyName)
			throws WebApplicationException;

	@POST
	@Path("metadata/properties/{propertyName}")
	ThingPropertyMetadataResource updateThingPropertyMetadata(
			@PathParam("propertyName") String propertyName, ThingPropertyMetadataResource updated)
			throws WebApplicationException;

	@GET
	@Path("{thingUUID}/metadata/properties/{propertyUUID}")
	ThingPropertyMetadataResource getThingPropertyMetadata(
			@PathParam("thingUUID") String thingUUID, @PathParam("propertyUUID") String propertyUUID)
			throws WebApplicationException;

	@GET
	@Path("metadata/actions")
	ThingActionMetadataCollectionResource getThingActionsMetadata() throws WebApplicationException;

	@PUT
	@Path("metadata/actions/{actionName}")
	Response registerThingActionMetadata(@PathParam("actionName") String actionName,
			ThingActionMetadataResource created) throws WebApplicationException;

	@GET
	@Path("metadata/actions/{actionName}")
	ThingActionMetadataResource getThingActionMetadata(@PathParam("actionName") String actionName)
			throws WebApplicationException;

	@DELETE
	@Path("metadata/actions/{actionName}")
	Response unregisterThingActionMetadata(@PathParam("actionName") String actionName)
			throws WebApplicationException;

	@POST
	@Path("metadata/actions/{actionName}")
	ThingActionMetadataResource updateThingActionMetadata(
			@PathParam("actionName") String actionName, ThingActionMetadataResource updated)
			throws WebApplicationException;

	@GET
	@Path("{thingUUID}/metadata/actions/{actionUUID}")
	ThingActionMetadataResource getThingActionMetadata(@PathParam("thingUUID") String thingUUID,
			@PathParam("actionUUID") String actionUUID) throws WebApplicationException;

}
